/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.gov.cemaden.library.model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author paulo.dias
 */
@Entity
@Table(name = "usuario")
@NamedQueries({
    @NamedQuery(name = "Usuario.findAll", query = "SELECT a FROM Usuario a ORDER BY a.id ASC"),
    @NamedQuery(name = "Usuario.findById", query = "SELECT a FROM Usuario a WHERE a.id = :id"),
    @NamedQuery(name = "Usuario.findByPermissao", query = "SELECT a FROM Usuario a WHERE a.permissao = :permissao"),
    @NamedQuery(name = "Usuario.findByAtivo", query = "SELECT a FROM Usuario a WHERE a.ativo = :ativo"),
    @NamedQuery(name = "Usuario.findByEmail", query = "SELECT a FROM Usuario a WHERE a.email = :email"),
    @NamedQuery(name = "Usuario.findByCelular", query = "SELECT a FROM Usuario a WHERE a.celular = :celular"),
})
public class Usuario implements Serializable, BaseEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false, unique = true)
    private Long id;
    
    @Column(name = "login")
    private String login;
    
    @Column(name = "senha")
    private String senha;
    
    @Column(name = "permissao")
    private String permissao;
    
    @Column(name = "ativo")
    private boolean ativo;
    
    @Column(name = "email")
    private String email;
    
    @Column(name = "celular")
    private String celular;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getSenha() {
        return senha;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }

    public String getPermissao() {
        return permissao;
    }

    public void setPermissao(String permissao) {
        this.permissao = permissao;
    }

    public boolean isAtivo() {
        return ativo;
    }

    public void setAtivo(boolean ativo) {
        this.ativo = ativo;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getCelular() {
        return celular;
    }

    public void setCelular(String celular) {
        this.celular = celular;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 17 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Usuario other = (Usuario) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Usuario{" + "id=" + id + ", login=" + login + ", senha=" + senha + ", permissao=" + permissao + ", ativo=" + ativo + ", email=" + email + ", celular=" + celular + '}';
    }
    
    
    
}
